package com.wangyadong.hobby.schedule.jobtask.dsa;

public class AddTwoInt {

    public int getSum(int a, int b) {
        //在此处写入代码
        int partNum = a ^ b;
        int carryNum = (a & b) << 1;
        while (carryNum != 0) {
            int temp = partNum ^ carryNum;
            carryNum = (partNum & carryNum) << 1;
            partNum = temp;
        }
        return partNum;
    }

    public static void main(String[] args) {
        AddTwoInt addTwoInt = new AddTwoInt();
        int sum = addTwoInt.getSum(19, 18);
        System.out.println(sum == 37);
    }
}
